package com.jielin.handling.service.record.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jielin.handling.entity.record.RecordTypeModel;
import com.jielin.handling.mapper.record.RecordCommonalityModelMapper;
import com.jielin.handling.mapper.record.RecordTypeModelMapper;
import com.jielin.handling.service.record.RecordTypeModelService;

@Service
public class RecordTypeModelServiceImpl implements RecordTypeModelService {
	@Autowired
	private RecordTypeModelMapper recordTypeModelMapper;
	@Autowired
	private RecordCommonalityModelMapper recordCommonalityModelMapper;

	@Override
	public List<RecordTypeModel> findAllModel(String orgId, String policeId) {
		List<RecordTypeModel> rtmList = recordTypeModelMapper.findAllModelByOrgId(orgId);
		String[] inString = { policeId, "0" };
		if (rtmList.size() > 0) {
			for (RecordTypeModel rtm : rtmList) {
				rtm.setCount(recordCommonalityModelMapper.getCountByModelId(rtm.getId(), inString));
			}
		}
		return rtmList;
	}

	@Override
	public String findMapInfo() {
		return recordTypeModelMapper.findMapInfo();
	}
}
